<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport"
          content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <meta name="format-detection" content="telephone=no"/>
    <title>公司认证</title>
    <link rel="stylesheet" type="text/css" href="../../css/aui.css"/>
    <link rel="stylesheet" type="text/css" href="../../css/common.css"/>
    <style>
        .btn {
            border: none;
            background: #ccc;
            text-align: center;
            font-size: 18px;
            color: #fff;
            font-weight: bold;
            border-radius: 5px;
            height: 55px;
            line-height: 55px;
        }

        .aui-title {
            font-size: 16px !important;
        }

        .myBtn {
            font-size: 18px;
        }
    </style>
</head>
<body>
<header class="aui-bar aui-bar-nav aui-border-b">
    <div class="aui-pull-left aui-iconfont aui-icon-left icon-left-coler" tapmode onclick="closeWin()"></div>
    <div class="aui-title">
        公司信息认证
    </div>
</header>
<footer class="aui-nav" id="aui-footer">
    <ul class="aui-bar-tab">
        <li class="" id="" tapmode>
            <div class="myBtn disable">提　交</div>
        </li>
    </ul>
</footer>
</body>
<script type="text/javascript" src="../../script/api.js"></script>
<script type="text/javascript" src="../../script/common.js"></script>
<script type="text/javascript" src="../../script/jquery-1.11.3.js"></script>
<script type="text/javascript">
    var msg="资料";
    apiready = function () {
        api.parseTapmode();

        canNotSumbit();
        var mobile = api.pageParam.mobile;
        var header = $api.dom('header');
        var footer = $api.dom('footer');
        $api.fixIos7Bar(header);

        var header_h = $api.offset(header).h;
        var footer_h = $api.offset(footer).h;
        var body_h = $api.offset($api.dom('body')).h - header_h - footer_h;
        api.openFrame({
            name: 'renzheng_frm',
            url: 'renzheng_frm.html',
            rect: {
                x: 0,
                y: header_h,
                w: 'auto',
                h: body_h
            },
            pageParam: {
                mobile: mobile
            },
            bounces: false,
            vScrollBarEnabled: false,
            hScrollBarEnabled: false
        });

        //接收来自frm的监听
        api.addEventListener({
            name: 'checkSubmit'
        }, function (ret) {
            if (ret && ret.value) {
                var tipMsg=ret.value.msg;
                if (ret.value.type == "canSumbit") {
                    $(".myBtn").removeClass("disable");
                    canSumbit();
                } else {
                    if (!$(".myBtn").hasClass("disable")) {
                        $(".myBtn").addClass("disable");
                    }
                    if(tipMsg=="身份认证"){
                        tipMsg="正确身份证";
                    }
                    msg=tipMsg;
                    canNotSumbit();
                }
            }
        });
    }

    function canNotSumbit() {
        $(".myBtn").unbind("click").bind("click", function () {
            api.toast({
                msg: "请填写"+msg
            })
        })
    }
    function canSumbit() {
        $(".myBtn").unbind("click").bind("click", function () {
            api.execScript({
                frameName:"renzheng_frm",
                script:"submit()"
            })
        })
    }
//    接收监听，单击上传提交按钮后，移除按钮单击操作
    function btnNotUnbind() {
        $(".myBtn").addClass("disable");
        $(".myBtn").unbind("click").bind("click", function () {
            api.toast({
                msg: "正在提交，请稍等"
            })
        })
    }
</script>
</html>
